package com.ayf.payment.game.api.type;


import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 是否枚举
 * @author lch
 * @date 2021/9/26
 */
@AllArgsConstructor
@Getter
public enum YesNoFlagEnum {

    /**
     * 是
     */
    YES(1, "是"),
    /**
     * 否
     */
    NO(0, "否");

    private Integer code;
    private String desc;

    /**
     * 根据code获取去value
     *
     * @param code ..
     * @return string
     */
    public static String getDescByCode(Integer code) {
        if(null == code){
            return  "";
        }
        for (YesNoFlagEnum platformFree : YesNoFlagEnum.values()) {
            if (code.equals(platformFree.getCode())) {
                return platformFree.getDesc();
            }
        }
        return "";
    }

}
